#!/bin/bash
cd ~/app-root/repo/扩展/
List=$(ls mynewtab-*[0-9].xpi)
if [ $List ]; then
    unzip -o $List install.rdf
    version=$(grep -o "[0-9]\{2\}\.[0-9]\{2\}\.[0-9]\{2\}\.[0-9]\{2\}" install.rdf)
    rm -f install.rdf
    cp -f $List ~/app-root/data/github-sh/xpi/myn/do/mynewtabL-${version}.xpi
    cd ~/app-root/data/github-sh/xpi/myn/do/
    sed -i "s#[0-9]\{2\}\.[0-9]\{2\}\.[0-9]\{2\}\.[0-9]\{2\}#${version}#" install.rdf
    zip -r mynewtabL-${version}.xpi *
    rm -f ~/app-root/repo/扩展/mynewtabL-*.xpi
    mv -f mynewtabL-${version}.xpi ~/app-root/repo/扩展/mynewtabL-${version}.xpi
fi
